I have two functions which need to call each other. |
Re: forward reference not resolved
Here is a demo of what I think you are asking about:
string test1(string, int)
string test2(string, int)
string s = test1("Input", 3)
print "\n" s
s = test2("TEST2", 2)
print "\n" s
string test1(string sInput, int iInput)
{ string s=test2("A",1)
print "Printed in test1: " s " " sInput ", " iInput ""
return "Returned from test1: " s
}
string test2(string sInput, int iInput)
{ return "Returned from test2: " sInput "-" iInput ""
}
|
Re: forward reference not resolved OurGuest - Thu Dec 23 16:07:21 EST 2010
Here is a demo of what I think you are asking about:
string test1(string, int)
string test2(string, int)
string s = test1("Input", 3)
print "\n" s
s = test2("TEST2", 2)
print "\n" s
string test1(string sInput, int iInput)
{ string s=test2("A",1)
print "Printed in test1: " s " " sInput ", " iInput ""
return "Returned from test1: " s
}
string test2(string sInput, int iInput)
{ return "Returned from test2: " sInput "-" iInput ""
}
I was trying to do it with Arguments passed by Ref with the ampersand which is why I was having trouble. |
Re: forward reference not resolved |
Re: forward reference not resolved Zetareticuli - Wed Jan 05 13:18:26 EST 2011 void Function2(string&, int&, int) void Function1(string &Message, int &Count, int Max) { if(Count>=Max){return} Message = Message "~" Count += 1 Function2(Message , Count, Max) } void Function2(string &Message, int &Count, int Max) { if(Count>=Max){return} Message = Message "#" Count += 1 Function1(Message , Count, Max) } string Message = "" int Count = 0 Function1(Message, Count, 5) print Count Message |
Re: forward reference not resolved Old thread, but I was wondering if there was a way to forward declare a function like "Shell createShell()" from Mathias's github Parallel's library? The above approach does not work presumably because of the "custom type" this function has. |
Re: forward reference not resolved strathglass - Wed Apr 11 08:11:24 EDT 2018 Old thread, but I was wondering if there was a way to forward declare a function like "Shell createShell()" from Mathias's github Parallel's library? The above approach does not work presumably because of the "custom type" this function has. Wild guess - should should be fine with simply declaring the Shell struct twice (before the forward declaration)? The need for forward declaration is usually a sign of a bad include layout. You might be better of with fixing your library structure in the long run. Regards, Mathias |